from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
import time
testCase="DBshop012_商品管理管理商品搜索商品"
goodsName="美的"
# 1.选择商品名称，输入“美的”，点击“搜索”按钮。
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,"商品管理","管理商品")
firefox.find_element_by_xpath("//input[@name='goods_name']").send_keys(goodsName)
firefox.find_element_by_xpath("//button[contains(.,'搜索')]").click()
time.sleep(2)
# 2.搜索成功美的的后台商品
if firefox.find_element_by_partial_link_text("商品预览").is_displayed():
    writeLog("%s 测试通过"%testCase)
else:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()